home *** CD-ROM | disk | FTP | other *** search
- (* Chapter 16 - Programming exercise 1 *)
- program Employee;
-
- {$R+}
-
- uses Person, Supervsr;
-
- var staff : array[1..10] of ^Person_ID;
- Sup : ^Supervisor;
- Prog : ^Programmer;
- Sec : ^Secretary;
- Con : ^Consultant;
- Index : integer;
-
- begin
-
- for Index := 1 to 10 do
- staff[Index]^.Init;
-
- WriteLn('XYZ Staff assignments.');
- WriteLn;
-
- new(Sup);
- staff[1] := Sup;
- Sup^.Init('Big John', 5100, 'President');
-
- new(Prog);
- staff[2] := Prog;
- Prog^.Init('Joe Hacker', 3500, 'Pascal');
-
- new(Prog);
- staff[3] := Prog;
- Prog^.Init('OOP Wizard', 7700, 'OOP Pascal');
-
- new(Sec);
- staff[4] := Sec;
- Sec^.Init('Tillie Typer', 2200, True, 85);
-
- new(Sup);
- staff[5] := Sup;
- Sup^.Init('Tom Talker', 5430,'Sales Manager');
-
- new(Prog);
- staff[6] := Prog;
- Prog^.Init('Dave Debug', 5725, 'Assembly Language');
-
- new(Con);
- staff[7] := Con;
- Con^.Init('Fred Fixer', 2150, 'Office copier');
-
- new(Con);
- staff[8] := Con;
- Con^.Init('Willy Waters', 1100, 'Water cooler');
-
- for Index := 1 to 8 do
- staff[Index]^.Display;
-
- end.
-
-
-
-
- (* Result of execution
-
- XYZ Staff assignments.
-
- Big John is the president and makes $5100 per month.
- Joe Hacker specializes in Pascal and makes $3500 per month.
- OOP Wizard specializes in OOP Pascal and makes $7700 per month.
- Tillie TYper can type 85 words per minute.
- Tom Talker is the Sales Manager and makes $5430 per month.
- Dave Debug specializes in Assembly Language and makes $5725 per month.
- Fred Fixer specializes in Office copier and his fee is $2150 per cons
- ulting month.
- Willy Waters specializes in Water cooler and his fee is $1100 per con
- sulting month.
-
- *)